CONFIG_UCLIBC_BUILD=n
CROSS_COMPILE ?= mips-linux-gnu-
CC = $(CROSS_COMPILE)gcc
CPLUSPLUS = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip

ifeq ($(CONFIG_UCLIBC_BUILD),y)
SDK_LIB_DIR = ../../../../build/lib-uclibc
else
SDK_LIB_DIR = ../../../../build/lib-glibc
endif

SAMPLES = test_ao test_ai test_ap_agc test_ap_hpf test_ap_ns\
					test_ai_ref test_aenc test_adec test_ap_aec\

INCLUDES = -I ../../../../include/api/cn -I ./audio_process/include

AUDIO_PROCESS_SRC = ./audio_process/src

LIB_FILE = $(SDK_LIB_DIR)/libimp.a $(SDK_LIB_DIR)/libalog.a
LIB_AUDIO_PROCESS = $(SDK_LIB_DIR)/libaudioProcess.so

LINK_LIB =  -lpthread -ldl -lrt -lm

all:$(SAMPLES)

test_ao:test_ao.c testopt.c $(LIB_FILE)
	$(CC) $(INCLUDES) -o $@ $^ $(LINK_LIB)

test_ai:test_ai.c testopt.c $(LIB_FILE)
	$(CC) $(INCLUDES) -o $@ $^ $(LINK_LIB)

test_ap_aec:test_ap_aec.c testopt.c $(LIB_FILE)
	$(CC) $(INCLUDES) -o $@ $^ $(LINK_LIB)

test_ai_ref:test_ai_ref.c testopt.c $(LIB_FILE)
	$(CC) $(INCLUDES) -o $@ $^ $(LINK_LIB)

test_aenc:test_aenc.c testopt.c $(LIB_FILE)
	$(CC) $(INCLUDES) -o $@ $^ $(LINK_LIB)

test_adec:test_adec.c testopt.c $(LIB_FILE)
	$(CC) $(INCLUDES) -o $@ $^ $(LINK_LIB)

test_ap_agc:test_ap_agc.c testopt.c $(AUDIO_PROCESS_SRC)/agc_process.c $(LIB_FILE) $(LIB_AUDIO_PROCESS)
	$(CC) $(INCLUDES) -o $@ $^ $(LINK_LIB)

test_ap_hpf:test_ap_hpf.c testopt.c $(AUDIO_PROCESS_SRC)/hpf_process.c $(LIB_FILE) $(LIB_AUDIO_PROCESS)
	$(CC) $(INCLUDES) -o $@ $^ $(LINK_LIB)

test_ap_ns:test_ap_ns.c testopt.c $(AUDIO_PROCESS_SRC)/ns_process.c $(LIB_FILE) $(LIB_AUDIO_PROCESS)
	$(CC) $(INCLUDES) -o $@ $^ $(LINK_LIB)

.PHONY:clean disclean

clean:
	rm -rf *.o
disclean:
	rm -rf $(SAMPLES)

